//
//  RootTarBarController.m
//  HeartTravel
//
//  Created by lanou on 15/10/24.
//  Copyright © 2015年 tantan. All rights reserved.
//

#import "RootTarBarController.h"
#import "HTIndexViewController.h"
#import "HTGroupViewController.h"
#import "HTGuideViewController.h"
#import "HTDynamicViewController.h"
#import "HTMineViewController.h"
@interface RootTarBarController ()

@end

@implementation RootTarBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self p_setupControllers];
}

// 添加controller
- (void)p_setupControllers {
    
    // 五个模块: 首页、社区、指导、动态、我的
    
    // 首页
    HTIndexViewController *indexVC = [[HTIndexViewController alloc] init];
    UINavigationController *indexNC = [[UINavigationController alloc] initWithRootViewController:indexVC];
    
    [indexNC.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:(UIBarMetricsDefault)];
    indexNC.tabBarItem.title = @"首页";
    indexNC.tabBarItem.image = [UIImage imageNamed:@"nav_index_nor"];
    
    // 社区
    HTGroupViewController *groupVC = [[HTGroupViewController alloc] init];
    UINavigationController *groupNC = [[UINavigationController alloc] initWithRootViewController:groupVC];
    
    [groupNC.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:(UIBarMetricsDefault)];
    groupNC.tabBarItem.title = @"社区";
    groupNC.tabBarItem.image = [UIImage imageNamed:@"nav_group_nor"];
    
    // 指导
    HTGuideViewController *guideVC = [[HTGuideViewController alloc] init];
    UINavigationController *guideNC = [[UINavigationController alloc] initWithRootViewController:guideVC];
    
    [guideNC.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:(UIBarMetricsDefault)];
    guideNC.tabBarItem.title = @"指导";
    guideNC.tabBarItem.image = [UIImage imageNamed:@"nav_guide_32"];
    
    // 动态
    HTDynamicViewController *dynamicVC = [[HTDynamicViewController alloc] init];
    UINavigationController *dynamicNC = [[UINavigationController alloc] initWithRootViewController:dynamicVC];
    
    [dynamicNC.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:(UIBarMetricsDefault)];
    dynamicNC.tabBarItem.title = @"动态";
    dynamicNC.tabBarItem.image = [UIImage imageNamed:@"nav_dynamic_nor"];
    
    // 我的
    HTMineViewController *mineVC = [[HTMineViewController alloc] init];
    UINavigationController *mineNC = [[UINavigationController alloc] initWithRootViewController:mineVC];
    
    [mineNC.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:(UIBarMetricsDefault)];
    mineNC.tabBarItem.title = @"我的";
    mineNC.tabBarItem.image = [UIImage imageNamed:@"nav_mine_nor"];
    
    self.viewControllers = @[indexNC, groupNC, guideNC, dynamicNC, mineNC];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
